﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfApplication1
{
    class ListDataFriendConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            try
            {
                List<object> data = new List<object>();
                List<object> result = new List<object>();
                data = (List<object>)value;

                if (data.Count != 0)
                {
                    for (int i = 0; i < data.Count; i++)
                    {
                        List<string> temp_1 = new List<string>();
                        temp_1 = (List<string>)data[i];

                        FriendControl temp = new FriendControl(temp_1[0], temp_1[1], temp_1[2]);
                        result.Add(temp_1);
                    }
                    return result;
                }
                else return result;

            }
            catch
            {
                return DependencyProperty.UnsetValue;
            }
        }
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return DependencyProperty.UnsetValue;
        }
    }
}
